package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbAdminMapper;
import com.dongdongshop.pojo.TbAdmin;
import com.dongdongshop.pojo.TbAdminExample;
import com.dongdongshop.service.TbAdminService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@DubboService
public class TbAdminServiceImpl implements TbAdminService {

    //注入mapper
    @Autowired
    private TbAdminMapper tbAdminMapper;

    //根据账号查询用户信息
    @Override
    public TbAdmin findTbAdminByName(String name) {
        TbAdminExample te = new TbAdminExample();
        TbAdminExample.Criteria criteria = te.createCriteria();
        criteria.andNameEqualTo(name);
        List<TbAdmin> list = tbAdminMapper.selectByExample(te);
        return (list ==null || list.isEmpty())?null:list.get(0);
    }
}
